<%@page import="sun.awt.DisplayChangedListener"%>
<%@page contentType="text/html" pageEncoding="UTF-8" import="java.io.*, java.sql.*, javax.sql.*"%>
<%
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cache");
    response.setDateHeader("Expires", -1);
    Connection con = com.elookinto.wordlist.Util.getCon();
    String oldListName = request.getParameter("oldListName");
    String newListName = request.getParameter("newListName");
    String uid = (String) session.getAttribute("uid");
    PreparedStatement st = con.prepareStatement("Delete from wordlist where listname=? and uid=? and word in (select word  from wordlist where listname=? and uid=?)");
    st.setString(1,oldListName);
    st.setString(2,uid);
    st.setString(3,newListName);
    st.setString(4,uid);
    st.executeUpdate();
    st = con.prepareStatement("Update wordlist set listname=? where listname=? and uid=?");
    st.setString(1, newListName);
    st.setString(2, oldListName);
    st.setString(3, uid);
    st.executeUpdate();
    st = con.prepareStatement("Update note set listname=? where listname=? and uid=?");
    st.setString(1, newListName);
    st.setString(2, oldListName);
    st.setString(3, uid);
    st.executeUpdate();
%>

